﻿using DevExpress.Xpf.Charts;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace TeBigCommonUI.Items
{
    public abstract partial class X1Y2Chart : X1Y2DiagramChartControl
    {
        public X1Y2Chart()
        {
            InitializeComponent();
        }

        protected override void OnInitChart()
        {
            InitChartInternal(chart, chart_diagram);
        }
    }

    public class X1Y2BarWithLineChart : X1Y2Chart
    {
        protected override Series CreateSeriesFromDataSource(IList<SeriesDataSource> source, int index)
        {
            if (source == this.SeriesDataSources)
            {
                return new BarSideBySideSeries2D()
                {
                    Model = new BorderlessGradientBar2DModel(),
                    BarWidth = source[index].BarWidth,
                };
            }
            else
            {
                return new LineSeries2D()
                {
                    MarkerModel = new CircleMarker2DModel(),
                    MarkerVisible = true,
                };
            }
        }
    }

    public class X1Y2BarWithAreaChart : X1Y2Chart
    {
        protected override Series CreateSeriesFromDataSource(IList<SeriesDataSource> source, int index)
        {
            if (source == this.SeriesDataSources)
            {
                return new BarSideBySideSeries2D()
                {
                    Model = new BorderlessGradientBar2DModel(),
                    BarWidth = source[index].BarWidth,
                };
            }
            else
            {
                return new SplineAreaSeries2D()
                {
                    Transparency = source[index].Transparency,
                    //MarkerModel = new CircleMarker2DModel(),
                    //MarkerVisible = true,
                };
            }
        }
    }
}